import request from "@/utils/request";

export function employee_loginAPI(data) {
  return request({
    url: '/employee/login',  // 保持相对路径 
    method: 'post',
    data: data
  })
}

export function employee_registerAPI(data) {
  return request({
    url: '/employee/register',  // 保持相对路径 
    method: 'post',
    data: data
  })
}

// 员工通用过滤查询
// export function employee_listWithFiltersAPI(cursor, limit = 10, eid, name, hiredate, status, hasImage, permission) {
//   return request({
//     url: '/employee/list/filters',
//     method: 'get',
//     params: {
//       cursor,
//       limit,
//       eid,
//       name,
//       hiredate,
//       status,
//       hasImage,
//       permission
//     }
//   })
// }
// api.js  
export function employee_listWithFiltersAPI(params = {}) {
  return request({
    url: '/employee/list/filters',
    method: 'get',
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      eid: params.eid,
      name: params.name,
      hiredate: params.hiredate,
      status: params.status,
      hasImage: params.hasImage,
      permission: params.permission
    }
  })
}

// 设置员工权限API 
export function employee_setPermissionAPI(data) {
  return request({
    url: '/employee/setPermission',
    method: 'post',
    data: data
  })
}








/////////customer
/////////customer
/////////customer
/////////customer
/////////customer
export function customer_loginAPI(data) {
  return request({
    url: '/customer/login',  // 保持相对路径 
    method: 'post',
    data: data
  })
}

export function customer_registerAPI(data,params) {
  return request({
    url: '/customer/register',  // 保持相对路径 
    method: 'post',
    data: data,
    params:params
  })
}

export function customer_listAPI(data) {
  return request({
    url: '/customer/list',  // 保持相对路径 
    method: 'get',
    params: data
  })
}

export function customer_ListWithFiltersAPI(params = {}) {
  return request({
    url: '/customer/list/filters',
    method: 'get',
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      cid: params.cid,
      name: params.name,
      phone: params.phone,
      company: params.company,
      hasLicense: params.hasLicense
    }
  })
}

export function customer_ListWithcFiltersAPI(params = {}) {
  return request({
    url: '/customer/list/cfilters',
    method: 'get',
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      cid: params.cid,
      name: params.name,
      phone: params.phone,
      company: params.company,
      hasLicense: params.hasLicense
    }
  })
}
export function customer_listByNameAPI(data) {
  return request({
    url: '/customer/list/name',
    method: 'post',
    data: { name: data.name },
    params: {
      offset: data.offset,
      limit: data.limit
    }
  })
}
// 客户统计API 
export const customer_StatsAPI = (params) => {
  return request({
    url: '/customer/stats',
    method: 'get',
    params 
  })
}









////prduct
////prduct
////prduct
////prduct
////prduct
export function product_ListWithFiltersAPI(params = {}) {
  return request({
    url: '/product/list/filter',
    method: 'get', // 根据您的Controller，应该使用GET方法 
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      pid: params.pid,
      name: params.name,
      sidefork: params.sidefork,
      panel_leg: params.panel_leg,
      customize: params.customize,
      t_bottomlayer: params.t_bottomlayer,
      t_leglayout: params.t_leglayout,
      tf_boardwing: params.tf_boardwing,
      f_structure: params.f_structure,
      f_blockheight: params.f_blockheight,
    }
  })
}
export function product_ListWithcFiltersAPI(params = {}) {
  return request({
    url: '/product/list/cfilter',
    method: 'get', // 根据您的Controller，应该使用GET方法 
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      pid: params.pid,
      name: params.name,
      sidefork: params.sidefork,
      panel_leg: params.panel_leg,
      customize: params.customize,
      t_bottomlayer: params.t_bottomlayer,
      t_leglayout: params.t_leglayout,
      tf_boardwing: params.tf_boardwing,
      f_structure: params.f_structure,
      f_blockheight: params.f_blockheight,
    }
  })
}
export function product_addAPI(data) {
  return request({
    url: '/product/add',  // 保持相对路径 
    method: 'post',
    data: data
  })
}

export function product_updateAPI(data) {
  return request({
    url: '/product/update',  // 保持相对路径 
    method: 'post',
    data: data
  })
}
// 产品统计API 
export const product_StatsAPI = (params) => {
  return request({
    url: '/product/stats',
    method: 'get',
    params 
  })
}









//order
//order
//order
//order
//order
export function order_ListWithFiltersAPI(params = {}) {
  return request({
    url: '/order/list/filter',
    method: 'get',
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      oid: params.oid,
      cid: params.cid,
      pid: params.pid,
      startOrderDate: params.startOrderDate,
      endOrderDate: params.endOrderDate,
      startEta: params.startEta,
      endEta: params.endEta,
      minPrice: params.minPrice,
      maxPrice: params.maxPrice,
      status: params.status,
     
    }
  })
}
export function order_ListWitheFiltersAPI(params = {}) {
  return request({
    url: '/order/list/efilter',
    method: 'get',
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      oid: params.oid,
      cid: params.cid,
      pid: params.pid,
    
    }
  })
}
export function order_ListWithcFiltersAPI(params = {}) {
  return request({
    url: '/order/list/cfilter',
    method: 'get',
    params: {
      cursor: params.cursor,
      limit: params.limit || 10,
      oid: params.oid,
      cid: params.cid,
      pid: params.pid,
      status:params.status
    
    }
  })
}

export function order_updateAPI(data) {
  return request({
    url: '/order/update',
    method: 'post',
    data
  })
}

export function order_addAPI(data) {
  return request({
    url: '/order/add',
    method: 'post',
    data
  })
}

// 每日统计 
export function orderstats_dailyAPI(month) {
  return request({
    url: '/orderstats/daily',
    method: 'get',
    params:  month  // 明确指定参数名 
    // params: { month }
  })
}
 
// 月度统计 
export function orderstats_monthlyAPI(year) {
  return request({
    url: '/orderstats/monthly',
    method: 'get',
    params:  year 
  })
}
 
// 年度统计 
export function orderstats_annualAPI(params) {
  return request({
    url: '/orderstats/annual',
    method: 'get',
    params: params
  })
}







//email
//email
//email
//email
//email

export function email_sendcodeAPI(params){
  return request({
    url: '/email/send',
    method: 'post',
    params: params
  })
}